<?php

class DBMResult {
	private $values = array();
	private $indexes = array();
	
	public function put($name, $value){
		$this->values[$name] = $value;
		$this->indexes[] = $name;
	}
	
	public function getAll(){
		return $this->values;
	}
	
	public function fetchByName($name){
		if(isset($this->values[$name])){
			return $this->values[$name];
		} else {
			//TODO: Better exceptions
			throw new Exception($name);
		}
	}
	
	public function fetchByIndex($index){
		if(isset($this->indexes[$index])){
			return $this->values[$this->indexes[$index]];
		} else {
			//TODO: Better exceptions
			throw new Exception($index);
		}
	}
}

?>
